package com.ying.controller.errors;

public class AppException extends RuntimeException {

    private AppExceptionData data;

    public AppException(ErrorCode code) {
        super(code.getMessage());
        data = new AppExceptionData(code.getCode(), code.getMessage());
    }

    public AppException(ErrorCode code, String extInfo) {
        super(code.getMessage() + extInfo);
        data = new AppExceptionData(code.getCode(), code.getMessage() + ":" + extInfo);
    }

    public AppExceptionData getData() {
        return data;
    }
}
